(function (win) {
	var xy = {
		init:function () {
			this.initEvent();
		},
		initEvent:function () {
			var params = {};

			$('#lifePhoto').fileupload({
				dataType: 'json',
				done: function (e, data) {
					//$(".abc").html("<img src='"+data.result.url+"'");
					var url = data.result.url;
					params.lifePhoto = url;
				}
			});

			$(".btn-addTeacher").on('click',function () {
				var arrs = $("#teacherForm").serializeArray();
				//{username:"",age:"",desc:""...}
        for (var i=0;i<arrs.length;i++){
	        params[arrs[i].name] = arrs[i].value;
        }
				/*arrs.forEach(function (item) {
					params[item.name] = item.value;
				})*/
				//console.log(params)
				$.ajax({
					type:"POST",
					url:"../api/addTeacher.php",
					data:params,
					dataType:"json",
					success:function (data) {
						data.status=="ok"
						console.log(data);
					}
				})
			});
		}
	};
	xy.init();
})(window)